﻿using System;
class AccuracySum
{
    static void Main()
    {
        double number;
        double prevsum = 1;
        double sum;
        Console.Write("Please input number: ");
        while (true)
        {
            try
            {
                number = int.Parse(Console.ReadLine());
                break;
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message + "\nPlease re-enter number:");
            }
        }
        for (double counter = 1; counter <= number; counter++)
        {
            if (counter == 1)
            {
                sum = (1 / counter);
            }
            else
            {
                if ((counter > 1) && (counter % 2 == 1))
                {
                    sum = (prevsum + ((1 / counter) * (-1)));
                }
                else
                {
                    sum = (prevsum + ((1 / counter)));
                }
            }
            Console.WriteLine("The sum of first {0} members is: {1:F4}", counter, sum);

            prevsum = sum;
        }
        Console.ReadLine();
    }
}

